package day35;
import java.util.*;

public class A2 {


    /**
     * dfs--遍历组合
     */



    static List<List<Integer>> ret= new ArrayList<>();
    static List<Integer> path = new ArrayList<>();
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int m = in.nextInt();
            dfs(n,m,1,0);
            for(int i=0;i<ret.size();i++) {
                for(int j=0;j<ret.get(i).size();j++) {
                    System.out.print(ret.get(i).get(j)+" ");
                }
                System.out.println();
            }
        }
    }
    public static void dfs(int n,int m,int pos, int sum) {
        if(sum>=m) {
            if(sum==m) ret.add(new ArrayList<>(path));
            return;
        }
        for(int i=pos;i<=n;i++) {
            path.add(i);
            dfs(n,m,i+1,sum+i);
            //回溯
            path.remove(path.size()-1);
        }

    }
}
